$(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
stresstest: xs_stress xs_watch_stress xenstored_test
- rm -rf $(TESTDIR)/store
+ rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
- rm -rf $(TESTDIR)/store
+ rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
export $(TESTENV); PID=`./xenstored_test --output-pid`; ./xs_watch_stress; ret=$$?; kill $$PID; exit $$ret
xs_dom0_test: xs_dom0_test.o utils.o
#! /bin/sh
-# Root directory has nothing in it.
-[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "" ]
+# Root directory has only tool dir in it.
+[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "tool" ]
# Create a file.
[ "`echo -e 'write /test create contents' | ./xs_test 2>&1`" = "" ]
# Directory shows it.
-[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "test" ]
+[ "`echo -e 'dir /' | ./xs_test 2>&1 | sort`" = "test
+tool" ]
# Make a new directory.
[ "`echo -e 'mkdir /dir' | ./xs_test 2>&1`" = "" ]
# Check it's there.
-DIR="`echo -e 'dir /' | ./xs_test 2>&1`"
-[ "$DIR" = "test
-dir" ] || [ "$DIR" = "dir
-test" ]
+DIR="`echo -e 'dir /' | ./xs_test 2>&1 | sort`"
+[ "$DIR" = "dir
+test
+tool" ]
# Check it's empty.
[ "`echo -e 'dir /dir' | ./xs_test 2>&1`" = "" ]
#! /bin/sh
# Test transactions.
+echo mkdir /test | ./xs_test
+
# Simple transaction: create a file inside transaction.
-[ "`echo -e '1 start /
-1 write /entry1 create contents
-2 dir /
-1 dir /
+[ "`echo -e '1 start /test
+1 write /test/entry1 create contents
+2 dir /test
+1 dir /test
1 commit
-2 read /entry1' | ./xs_test`" = "1:entry1
+2 read /test/entry1' | ./xs_test`" = "1:entry1
2:contents" ]
-echo rm /entry1 | ./xs_test
+echo rm /test/entry1 | ./xs_test
# Create a file and abort transaction.
-[ "`echo -e '1 start /
-1 write /entry1 create contents
-2 dir /
-1 dir /
+[ "`echo -e '1 start /test
+1 write /test/entry1 create contents
+2 dir /test
+1 dir /test
1 abort
-2 dir /' | ./xs_test`" = "1:entry1" ]
+2 dir /test' | ./xs_test`" = "1:entry1" ]
-echo write /entry1 create contents | ./xs_test
+echo write /test/entry1 create contents | ./xs_test
# Delete in transaction, commit
-[ "`echo -e '1 start /
-1 rm /entry1
-2 dir /
-1 dir /
+[ "`echo -e '1 start /test
+1 rm /test/entry1
+2 dir /test
+1 dir /test
1 commit
-2 dir /' | ./xs_test`" = "2:entry1" ]
+2 dir /test' | ./xs_test`" = "2:entry1" ]
# Delete in transaction, abort.
-echo write /entry1 create contents | ./xs_test
-[ "`echo -e '1 start /
-1 rm /entry1
-2 dir /
-1 dir /
+echo write /test/entry1 create contents | ./xs_test
+[ "`echo -e '1 start /test
+1 rm /test/entry1
+2 dir /test
+1 dir /test
1 abort
-2 dir /' | ./xs_test`" = "2:entry1
+2 dir /test' | ./xs_test`" = "2:entry1
2:entry1" ]
# Transactions can take as long as the want...
-[ "`echo -e 'start /
+[ "`echo -e 'start /test
sleep 1
-rm /entry1
+rm /test/entry1
commit
-dir /' | ./xs_test`" = "" ]
+dir /test' | ./xs_test`" = "" ]
# ... as long as noone is waiting.
-[ "`echo -e '1 start /
-2 mkdir /dir
-1 mkdir /dir
-1 dir /
+[ "`echo -e '1 start /test
+2 mkdir /test/dir
+1 mkdir /test/dir
+1 dir /test
1 commit' | ./xs_test 2>&1`" = "1:dir
FATAL: 1: commit: Connection timed out" ]
# Events inside transactions don't trigger watches until (successful) commit.
-[ "`echo -e '1 watch / token 100
-2 start /
-2 mkdir /dir/sub
+[ "`echo -e '1 watch /test token 100
+2 start /test
+2 mkdir /test/dir/sub
1 waitwatch' | ./xs_test 2>&1`" = "1:waitwatch timeout" ]
-[ "`echo -e '1 watch / token 100
-2 start /
-2 mkdir /dir/sub
+[ "`echo -e '1 watch /test token 100
+2 start /test
+2 mkdir /test/dir/sub
2 abort
1 waitwatch' | ./xs_test 2>&1`" = "1:waitwatch timeout" ]
-[ "`echo -e '1 watch / token 100
-2 start /
-2 mkdir /dir/sub
+[ "`echo -e '1 watch /test token 100
+2 start /test
+2 mkdir /test/dir/sub
2 commit
1 waitwatch
-1 ackwatch token' | ./xs_test 2>&1`" = "1:/dir/sub:token" ]
+1 ackwatch token' | ./xs_test 2>&1`" = "1:/test/dir/sub:token" ]
# Rm inside transaction works like rm outside: children get notified.
-[ "`echo -e '1 watch /dir/sub token 100
-2 start /
-2 rm /dir
+[ "`echo -e '1 watch /test/dir/sub token 100
+2 start /test
+2 rm /test/dir
2 commit
1 waitwatch
-1 ackwatch token' | ./xs_test 2>&1`" = "1:/dir/sub:token" ]
+1 ackwatch token' | ./xs_test 2>&1`" = "1:/test/dir/sub:token" ]
char *cmd = talloc_asprintf(NULL, "echo -n r0 > %s/.perms", dir);
if (mkdir(dir, 0700) != 0)
barf_perror("Creating directory %s", dir);
+ if (mkdir(talloc_asprintf(cmd, "%s/tool", dir), 0700) != 0)
+ barf_perror("Creating directory %s/tool", dir);
do_command(cmd);
talloc_free(cmd);
}
char *nodename;
bool ret = false;
+ /* Ignore tool/ dir. */
+ if (streq(node, "/tool"))
+ return true;
+
/* FILE backend expects talloc'ed pointer. */
nodename = talloc_strdup(NULL, node);
permsa = a->get_perms(ah, nodename, &numpermsa);